/*
 *  $Id: Text.cs 1099 2010-05-26 15:31:29Z thenn.erannor $
 *	This file is a part of Ragima CCG.
 *	(C) 2008-2009 Ragima development group.
 *
 *	Licensed under the terms of the GNU GPL License version 2.
 *
 */

using AgateLib.Geometry;

namespace Ragima.UI {
    public class OldText: Region {
        private string _text;
        private Color _color;
        private int _padding;
        private TextAlignment _alignment;

        public OldText(Rectangle rect, string text, Color color): base(rect) {
            _text = text;
            _color = color;
            _padding = 0;
            _alignment = TextAlignment.Left;
        }

        public string Value {
            get { return _text; }
            set { _text = value; }
        }
        public Color TextColor {
            get { return _color; }
            set { _color = value; }
        }
        public int Padding {
            get { return _padding; }
            set { _padding = value; }
        }
        public TextAlignment Alignment {
            get { return _alignment; }
            set { _alignment = value; }
        }

        public override void Draw() {
            Data.Fonts.Main.Color = _color;
            int x = Rect.X + _padding, y = Rect.Y + _padding, width = Rect.Width - _padding*2;
            switch (_alignment) {
                case TextAlignment.Left:
                    Data.Fonts.Main.Draw(x, y, _text);
                    break;
                case TextAlignment.Center:
                    Data.Fonts.Main.DrawCenter(x + width/2, y, _text);
                    break;
                case TextAlignment.Right:
                    Data.Fonts.Main.DrawRight(x + width, y, _text);
                    break;
            }
        }
    }
}
